package com.bao123.userinfo.controller;

import com.bao123.userinfo.entities.Userinfo;
import com.bao123.utils.result.GeneralResult;
import com.bao123.userinfo.service.UserinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * 用户信息控制器层
 * @author lbw
 */
@RestController
@RequestMapping("userinfoController")
public class UserinfoController {

    @Autowired
    private UserinfoService userinfoService;

    @RequestMapping("register")
    public GeneralResult<?> register(Userinfo userinfo, String verificationCode){
        return userinfoService.register(userinfo, verificationCode);
    }

    @RequestMapping("login")
    public GeneralResult<?> login(HttpServletResponse response, String username, String password){
        return userinfoService.login(username, password, response);
    }

}
